﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using 刘颜红销售项目管理.Business.DOM ;
using XDesigner.ORM;
using 刘颜红销售项目管理.Business;

namespace 刘颜红销售项目管理
{
    public partial class frm产品型号基本信息 : DevExpress.XtraEditors.XtraForm
    {
        public frm产品型号基本信息()
        {
            InitializeComponent();
            strTitle = this.Text;
        }
        
        private string strTitle = null;
        
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            MyApplicationFramework.Instance.ORMEngine.OpenConnection();
            Array units = MyApplicationFramework.Instance.ORMEngine.ReadAllInstances(typeof(Class产品型号 ));
            ORMBindingSource ds = MyApplicationFramework.Instance.ORMEngine.CreateBindingSource(
                typeof(Class产品型号),
                units);

            ds.LogItemChange = true;
            myGridControl.DataSource = ds;
            MyApplicationFramework.Instance.ORMEngine.CloseConnection();
        }

        private void btnNew_Click(object sender, EventArgs e)
        {
            DevExpress.XtraEditors.INavigatableControl ctl = (DevExpress.XtraEditors.INavigatableControl)myGridControl;
            ctl.DoAction(DevExpress.XtraEditors.NavigatorButtonType.Append);
            //DataGridViewRow row = myGridControl myDataGridView.Rows[ myDataGridView.NewRowIndex ] ;
            //row.Selected = true ;
            //myDataGridView.CurrentCell = row.Cells[1];
            //myDataGridView.BeginEdit(false );
        }

        private void frm单位基本信息_Load(object sender, EventArgs e)
        {
            lstUnit.DataSource = MyApplicationFramework.Instance.单位列表;
            btnRefresh_Click(null, null);
        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            DevExpress.XtraEditors.INavigatableControl ctl = (DevExpress.XtraEditors.INavigatableControl)myGridControl;
            ctl.DoAction(DevExpress.XtraEditors.NavigatorButtonType.Remove);
        }
    }
}